<%@ page import="com.example.ordersystem.domain.Customer" %><%--
  Created by IntelliJ IDEA.
  User: 檬zhu
  Date: 2021/12/14
  Time: 20:24
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" pageEncoding="UTF-8" %>
<html>
<head>
    <title></title>
    <link rel="stylesheet" href="${pageContext.request.contextPath}/resources/css/pintuer.css">
    <link rel="stylesheet" href="${pageContext.request.contextPath}/resources/css/admin.css">
    <script src="${pageContext.request.contextPath}/resources/js/jquery.js"></script>
    <script src="${pageContext.request.contextPath}/resources/js/pintuer.js"></script>
</head>
<body>
<%
    Object object = request.getSession().getAttribute("customer");
    if (object == null) {
        response.sendRedirect("/");
        return; //不再执行接下来的代码
    }
    if (request.getAttribute("originalPwdError") !=null){
        out.println("<script language='JavaScript'>alert('原始密码不正确');</script>");
    }
    if (request.getAttribute("modifySuccess") !=null){
        out.println("<script language='JavaScript'>alert('密码修改成功');</script>");
    }
    Customer customer = (Customer)object;
%>
<div class="panel admin-panel">
    <div class="panel-head"><strong><span class="icon-key"></span>顾客修改密码</strong></div>
    <div class="body-content">
        <form method="post" class="form-x" action="${pageContext.request.contextPath}/customer/modifyPass">
            <div class="form-group">
                <div class="label">
                    <%--@declare id="sitename"--%><label for="sitename">我的帐号：</label>
                </div>
                <div class="field">
                    <label style="line-height:33px;">
                        <%=customer.getName()%>
                    </label>
                </div>
            </div>
            <div class="form-group">
                <div class="label">
                    <label for="sitename">原始密码：</label>
                </div>
                <div class="field">
                    <input type="password" class="input w50" id="mpass" name="mpass" size="50" placeholder="请输入原始密码"
                           data-validate="required:请输入原始密码"/>
                </div>
            </div>
            <div class="form-group">
                <div class="label">
                    <label for="sitename">新密码：</label>
                </div>
                <div class="field">
                    <input type="password" class="input w50" name="newpass" size="50" placeholder="请输入新密码"
                           data-validate="required:请输入新密码,length#>=5:新密码不能小于5位"/>
                </div>
            </div>
            <div class="form-group">
                <div class="label">
                    <label for="sitename">确认新密码：</label>
                </div>
                <div class="field">
                    <input type="password" class="input w50" name="renewpass" size="50" placeholder="请再次输入新密码"
                           data-validate="required:请再次输入新密码,repeat#newpass:两次输入的密码不一致"/>
                </div>
            </div>

            <div class="form-group">
                <div class="label">
                    <label></label>
                </div>
                <div class="field">
                    <button class="button bg-main icon-check-square-o" type="submit"> 提交</button>
                </div>
            </div>
        </form>
    </div>
</div>
<script>

</script>
</body>
</html>
